package net.chenlin.dp.modules.base.manager.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import net.chenlin.dp.common.constant.SystemConstant.StatusType;
import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.modules.base.dao.SysWarehouseMapper;
import net.chenlin.dp.modules.base.entity.SysWarehouseEntity;
import net.chenlin.dp.modules.base.manager.SysWarehouseManager;

/**
 * 仓库
 *
 * @author ZhouChenglin
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2018年12月03日 下午10:05:32
 */
@Component("sysWarehouseManager")
public class SysWarehouseManagerImpl implements SysWarehouseManager {

	@Autowired
	private SysWarehouseMapper sysWarehouseMapper;
	

	@Override
	public List<SysWarehouseEntity> listSysWarehouse(Page<SysWarehouseEntity> page, Query search) {
		return sysWarehouseMapper.listForPage(page, search);
	}

	@Override
	public int saveSysWarehouse(SysWarehouseEntity sysWarehouse) {
		return sysWarehouseMapper.save(sysWarehouse);
	}

	@Override
	public SysWarehouseEntity getSysWarehouseById(Long id) {
		SysWarehouseEntity sysWarehouse = sysWarehouseMapper.getObjectById(id);
		return sysWarehouse;
	}

	@Override
	public int updateSysWarehouse(SysWarehouseEntity sysWarehouse) {
		return sysWarehouseMapper.update(sysWarehouse);
	}

	@Override
	public int batchRemove(Long[] id) {
		int count = sysWarehouseMapper.batchRemove(id);
		return count;
	}

	@Override
	public int updateSysWarehouserMan(Long[] id) {
		Query query = new Query();
		query.put("status", StatusType.DISABLE.getValue());
		query.put("id", id);
		int count = sysWarehouseMapper.updateWarehouseStaic(query);
		return count;
	}



	@Override
	public int updateSysWarehouserShao(Long[] id) {
		Query query = new Query();
		query.put("status", StatusType.ENABLE.getValue());
		query.put("id", id);
		int count = sysWarehouseMapper.updateWarehouseStaic(query);
		return count;
	}
	
}
